# -*- coding: utf-8 -*-
require 'test/unit'
require 'm3g'

class Test_TriangleStripArray < Test::Unit::TestCase
  def setup
  end

  def teadown
  end

  def test_default_variables_1

    indices       = [10,11,12, 13,14,15]
    strip_lengths = [3,3]
    tris          = M3G::TriangleStripArray.new indices, strip_lengths

    assert_equal 6, tris.index_count
    
    assert_equal 10, tris.indices[0]
    assert_equal 11, tris.indices[1]
    assert_equal 12, tris.indices[2]
    assert_equal 13, tris.indices[3]
    assert_equal 14, tris.indices[4]
    assert_equal 15, tris.indices[5]
  end

  def test_default_variables_2
    first_index   = 10
    strip_lengths = [3,3]
    tris          = M3G::TriangleStripArray.new first_index, strip_lengths

    assert_equal 6, tris.index_count
    
    assert_equal 10, tris.indices[0]
    assert_equal 11, tris.indices[1]
    assert_equal 12, tris.indices[2]
    assert_equal 13, tris.indices[3]
    assert_equal 14, tris.indices[4]
    assert_equal 15, tris.indices[5]
  end

  def test_duplicate
    indices       = [10,11,12, 13,14,15]
    strip_lengths = [3,3]
    tris1         = M3G::TriangleStripArray.new indices, strip_lengths

    tris2 = tris1.duplicate

    assert_not_equal tris1, tris2
    assert_equal 6, tris2.index_count
    assert_equal 10, tris2.indices[0]
    assert_equal 11, tris2.indices[1]
    assert_equal 12, tris2.indices[2]
    assert_equal 13, tris2.indices[3]
    assert_equal 14, tris2.indices[4]
    assert_equal 15, tris2.indices[5]
  end
end
